EMT Practice Test

1. Question Content...


Question List

Question1: Products may be accessed using SEO friendly URLs like /my-product instead of /catalog/product/view/id/{ID} How is this one?

Question2: A custom module must make changes to the schema following each setup:upgrade run. This must be done after all other module's schema updates have been applied.
How is this accomplished?

Question3: You are implementing a custom module MyModule, which provides an implementation of
\Psr\Log\LoggerInterface called \MyCompany\MyModule\Logger.
The LoggerInterface has the default preference declared in app/etc/di.xml.
Keeping upgradability in mind, how do you make \MyCompany\MyModule\Logger the default implementation of the LoggerInterface globally?

Question4: A custom module needs to log all calls of \Magento\Customer\Api\AddressRepositoryInterface::save().
Which mechanism do you use?

Question5: You have created a custom module which must perform an action immediately after an order is placed, but only on the store front of the merchant site. You have selected the checkout_submit_all_after as the target event which the module will observe.
In which file will the event observer be declared?

Question6: You got a notification about error that occurred on a production environment. The merchant gave you the error identifier.
How do you find the error message based on the identifier?

Question7: How do you pass an array ['one', 'two] as a parameter to you block using the layout XML arguments directive?

Question8: In the module located at app/code/MyCompany/MyModule there is a JS module in the file view/frontend/web/register.js. The Magento base URL is https://magento.host/ and the luma theme with the en_US locate is used.
What is the public URL for this file?

Question9: You are implementing a before plugin in MyCompany_Magic. It will intercept the same method that MyCompany_Admission is already intercepting using a before plugin: Topmenu::getBlockHtml Which two actions are required to ensure the new plugin will execute last? (Choose two.)

Question10: You are tasked with ensuring customers who log into the site are authorized. By default, this consists of ensuring the customers email and password match the values in the database. On this project, you need to verify additional data in this process.
Keeping in mind upgradeability, how is this done?

Question11: A merchant tasks you to keep sales managers out of the system configuration backend pages.
How do you do that using the admin interface?

Question12: You are creating a new page layout for your custom module.
What is the primary difference between container and block elements?

Question13: How do you add a foreign key to an existing table created by another module?

Question14: You are developing a new theme which inherits from the Magento_Luma theme.
How is this accomplished?

Question15: How does Magento store customer address attribute values?

Question16: You have created a new section in system configuration under the Catalog tab:

How do you restrict an access to the section using Magento ACL?

Question17: You have created a new block and will be adding this block on every page. The block contains user-specific information and cannot be cached. The block is added to the default.xml with:

What does this accomplish?

Question18: You are adding a new menu item to the admin backend which will link to a custom backend page.
The declaration of the route:

What do you specify as the menu item action attribute value so it links to /admin/mycompany/mymodule/?

Question19: While developing a module you need to modify an existing Data Patch.
How can you force Magento to execute an existing Data Patch file again?

Question20: The constructor function for \Magento\Catalog\Model\Category contains this excerpt:

With the automatic dependency injection that Magento provides, how is the StoreManagerInterface resolved?

Question21: What happens when a category's is_anchor attribute is set to 1?

Question22: While reviewing a layout file named sales_order_view.xml you notice the element
<update handle="customer_account"/>
What is the purpose of this element?

Question23: The module MyCompany_MyModule will add a new page to the admin interface at the URL path admin/mycompany/entity_grid.
How do you name the file containing the action controller class so the admin router matches the path to the class?

Question24: Assume that a customer's cart only includes one downloadable product.
What effect will it cause on the quote object?

Question25: You have created a module with a custom ACL resource and want to restrict access to resources of your module.
Which three items are restricted based on ACL role permissions? (Choose three.)

Question26: You are working on a Magento store which will be selling in two countries. Each country has its own set of payment methods.
How do you organize the project to support this requirement?

Question27: You have been given the task of importing products from an external source. You decide to create a custom module to do this. The class handling the import creates a product for each record, sets the data on it and saves it to the database.
What do you inject into a constructor to represent each product you create?

Question28: There are two different configurable products which both share one variation. The shared variation is represented by the same simple product.
A customer added both configurables to the cart with the same selected variation?
How will they be displayed?

Question29: How do you obtain customer information in a JavaScript module?

Question30: You are reviewing a Magento module and see a directory named Service.
What can you determine from this directory's name?

Question31: A client has asked you to include category url keys in product URLs.
How is this done?

Question32: What will be the result of calling the save() method on a collection instance?

Question33: You need to find all orders in the processing state. You have written the code:

How do you resolve the exception?

Question34: Your module, MyCompany_MyModule, is using the frontName mymodule. You need to locate the class responsible for the frontend path /mymodule/custom.
What file contains the controller class for the frontend path /mymodule/custom?

Question35: You added a new constructor argument to an existing action controller class.
When you reload the page you get a PHP error that the wrong argument is passed to the class.
How do you fix this?

Question36: You are working on a new entity called vendor. You implemented the model, resource model and collection.
You want to ensure that standard model events will be fired for your model, so an observer can be created for the events vendor_save_after, vendor_save_commit_after and others.
How do you do that?

Question37: The module MyCompany_MyModule provides custom admin interface pages.
Access to these pages should only be granted to specific users.
You add the required configuration to the module's acl.xml file, but the setting does not seem to work as expected.
How do you visually check if Magento evaluates your ACL resource as expected?